#ifndef CATALOGUEWGT_H
#define CATALOGUEWGT_H

#include <QWidget>
#include "contentinfo.h"

namespace Ui {
class CatalogueWgt;
}

class CatalogueListModel;
class CatalogueWgt : public QWidget
{
    Q_OBJECT

public:
    explicit CatalogueWgt(QWidget *parent = nullptr);
    explicit CatalogueWgt(const QString& filePath, QWidget *parent = nullptr);
    ~CatalogueWgt();

    void setFile(const QString& filePath);
    QString file();

    CatalogueItem getCatalogueItem(int index);
    CatalogueItem getCurrentItem();

Q_SIGNALS:
    void chapterClickedSgl(const CatalogueItem& catalogueItem);
    void analyzeAhapterFinishedSgl();

private:
    void initStyle();
    void initConnect();

    void itemClickedSlt(const QModelIndex &index);

    void analyzeAhapter();

private:
    Ui::CatalogueWgt *ui;
    CatalogueListModel* _model;

    QString _filePath;
};

#endif // CATALOGUEWGT_H
